import 'package:app/jspangStudy/widget/keepAlive.dart';
import 'package:flutter/material.dart';

class Email extends StatefulWidget {
  @override
  _EmailState createState() => _EmailState();
}

class _EmailState extends State<Email> with SingleTickerProviderStateMixin {
  // with多继承
  TabController _controller;

  @override
  void initState() {
    _controller = TabController(length: 3, vsync: this);
    super.initState();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Email'),
        bottom: TabBar(
          controller: _controller,
          tabs: [
            Tab(icon: Icon(Icons.ac_unit)),
            Tab(icon: Icon(Icons.access_alarm)),
            Tab(icon: Icon(Icons.accessibility)),
          ],
        ),
      ),
      body: TabBarView(
        controller: _controller,
        children: <Widget>[
          KeepAliveCom(),
          KeepAliveCom(),
          KeepAliveCom(),
        ],
      ),
    );
  }
}
